In this How To we are going to make a minimalfs built with our GCC 4.3.3 cross-compiler. More like a _bare_ minimalfs ;-) You can then test this minimalfs with QEMU. Once you have accomplished that I recommend pointing your browser to FHS and make a true Linux file system. NOTE: This will be the file system only, you'll still need to populate the file system with the standard Linux utilities. For this we'll be using BusyBox. I recommended using BusyBox only for testing or for a _very_ lightweight Linux file system. BusyBox is a useful tool, but is also _very_ limited in its capabilities which can become an annoyance, real quick (voice of experience >_<). For a good reference on the standard Linux utilities refer to LFS.
NOTE: Some versions of BusyBox (such as busybox-1.20.2) do not support >glibc-2.14 and thus the build will fail. Refer here for more information.
Tar Balls
Here is a list of source packages that we'll need for the build. You can either download them now or wait 'til later in the How To.
busybox-1.13.3.tar.bz2
Create a Workspace
I recommend creating a workspace under your /home/<your user>/ directory that is dedicated to this build. So let's fire up your terminal and run the following:
$ export RFS=~/workbench/xroot/busybox-1.13.3/minimalfs
$ mkdir -pv $RFS
$ cd $RFS
Gather the Sources
Now that we have a workspace created and we are currently in the minimalfs directory we can begin bringing down the sources and extracting them.
busybox
$ wget http://www.busybox.net/downloads/busybox-1.13.3.tar.bz2
$ tar -pxjf busybox-1.13.3.tar.bz2
Build BusyBox
$ cd busybox-1.13.3
$ make defconfig
$ make menuconfig
Set x-compiler prefix:
"BusyBox Settings" -> "Build Options" -> "Cross-Compiler Prefix" = /home/<your user>/workbench/gcc-4.3.3/arm/bin/arm-none-linux-gnueabi-
Change BusyBox installation path:
"BusyBox Settings" -> "Installation Options" -> "BusyBox installation" = /home/<your user>/workbench/busybox-1.13.3/minimalfs
$ make
$ make install
NOTE: Depending on whether you are using a cross-compiler built from my other wikis you might need to change "Cross-Compiler Prefix" to point to your cross-compiler.
Check to see if BusyBox created and populated lib directory with libc.so.x, libm.so.x and ld-linux.so.x. If not, then copy these from the ../arm/sysroot/lib directory of gcc-x.x.x:
NOTE: Depending on whether you are using a cross-compiler built from my other wikis you might need to change SYSROOTDIR to point to your cross-compiler.
Create the minimalfs
$ cd dev
$ sudo mknod console c 5 1
$ sudo mknod null c 3 1
$ cd $RFS
$ mkdir tmp root etc proc
$ echo "root::0:0:root:/root:/bin/sh" > $RFS/etc/passwd
$ echo "root:x:0:" > $RFS/etc/groups
$ echo "::respawn:/sbin/getty -L ttyAMA0 115200 xterm" > $RFS/etc/inittab
Yep, it's that simple. Be careful when doing sudo mknod, i.e. make sure you are in the dev directory of /home/<your user>/workbench/xroot/busybox-1.13.3/minimalfs/. Or wherever you put your BusyBox build.
How To Make a Linux Minimal File System
Intro
In this How To we are going to make a minimalfs built with our GCC 4.3.3 cross-compiler. More like a _bare_ minimalfs ;-) You can then test this minimalfs with QEMU. Once you have accomplished that I recommend pointing your browser to FHS and make a true Linux file system. NOTE: This will be the file system only, you'll still need to populate the file system with the standard Linux utilities. For this we'll be using BusyBox. I recommended using BusyBox only for testing or for a _very_ lightweight Linux file system. BusyBox is a useful tool, but is also _very_ limited in its capabilities which can become an annoyance, real quick (voice of experience >_<). For a good reference on the standard Linux utilities refer to LFS.
NOTE: Some versions of BusyBox (such as busybox-1.20.2) do not support >glibc-2.14 and thus the build will fail. Refer here for more information.
Tar Balls
Here is a list of source packages that we'll need for the build. You can either download them now or wait 'til later in the How To.
Create a Workspace
I recommend creating a workspace under your /home/<your user>/ directory that is dedicated to this build. So let's fire up your terminal and run the following:
Gather the Sources
Now that we have a workspace created and we are currently in the minimalfs directory we can begin bringing down the sources and extracting them.
busybox
Build BusyBox
NOTE: Depending on whether you are using a cross-compiler built from my other wikis you might need to change "Cross-Compiler Prefix" to point to your cross-compiler.
Check to see if BusyBox created and populated lib directory with libc.so.x, libm.so.x and ld-linux.so.x. If not, then copy these from the ../arm/sysroot/lib directory of gcc-x.x.x:
NOTE: Depending on whether you are using a cross-compiler built from my other wikis you might need to change SYSROOTDIR to point to your cross-compiler.
Create the minimalfs
Yep, it's that simple. Be careful when doing sudo mknod, i.e. make sure you are in the dev directory of /home/<your user>/workbench/xroot/busybox-1.13.3/minimalfs/. Or wherever you put your BusyBox build.
Package it up
Now you are ready to test with QEMU :D